// dept 配置
import request from '@/utils/request'

const api = {
    dept: '/system/sysDept'
}

export default api

export function getDeptList(parameter) {
    return request({
        url: api.dept + '/getSysDeptAll',
        method: 'get',
        params: parameter
    })
}
export function saveDept(parameter) {
    if (parameter.id > 0) {
        return modifyDept(parameter)
    } else {
        return addDept(parameter)
    }
}
function addDept(parameter) {
    return request({
        url: api.dept + '/saveSysDept',
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}
function modifyDept(parameter) {
    return request({
        url: api.dept + '/modifySysDept',
        method: 'put',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}
export function delDept(deptId) {
    return request({
        url: api.dept + '/removeSysDept/'+ `${deptId}`,
        method: 'delete'
    })
}